import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsUrl, IsOptional, IsBoolean, IsNumber } from 'class-validator';

/**
 * 导航站点响应 DTO
 */
export class NavigationResponseDto {
  @ApiProperty({ description: '站点ID' })
  id: number;

  @ApiProperty({ description: '站点名称' })
  name: string;

  @ApiProperty({ description: '站点描述' })
  description: string;

  @ApiProperty({ description: '站点链接' })
  url: string;

  @ApiProperty({ description: '站点图标路径' })
  logo: string;
}

/**
 * 创建导航站点 DTO
 */
export class CreateNavigationDto {
  @ApiProperty({ description: '站点名称' })
  @IsString()
  name: string;

  @ApiProperty({ description: '站点描述', required: false })
  @IsOptional()
  @IsString()
  description?: string;

  @ApiProperty({ description: '站点链接' })
  @IsUrl({}, { message: '请输入有效的URL地址' })
  url: string;

  @ApiProperty({ description: '站点图标路径', required: false })
  @IsOptional()
  @IsString()
  logo?: string;

  @ApiProperty({ description: '排序权重', required: false, default: 0 })
  @IsOptional()
  @IsNumber()
  sort?: number;

  @ApiProperty({ description: '是否启用', required: false, default: true })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;
}

/**
 * 更新导航站点 DTO
 */
export class UpdateNavigationDto {
  @ApiProperty({ description: '站点名称', required: false })
  @IsOptional()
  @IsString()
  name?: string;

  @ApiProperty({ description: '站点描述', required: false })
  @IsOptional()
  @IsString()
  description?: string;

  @ApiProperty({ description: '站点链接', required: false })
  @IsOptional()
  @IsUrl({}, { message: '请输入有效的URL地址' })
  url?: string;

  @ApiProperty({ description: '站点图标路径', required: false })
  @IsOptional()
  @IsString()
  logo?: string;

  @ApiProperty({ description: '排序权重', required: false })
  @IsOptional()
  @IsNumber()
  sort?: number;

  @ApiProperty({ description: '是否启用', required: false })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;
}